function request(url, data ={}, method = "GET") {
	return new Promise((resolve, reject) => {
		let header = {
			'Content-Type': 'application/json',
			// 'Content-Type': 'application/x-www-form-urlencoded'
		};//自定义请求头
		let value = uni.getStorageSync('info')
		let token = value.accessToken
		if (token) {
		  header['token'] =  token;
		}
		let datas = {...data}
		uni.request({
			url:url,
			// data:data,
			data:datas,
			method:method,
			header:{
				'authorization':'Bearer ' + token,
				// config.headers['tenant-id'] = `${'1'}`
				['tenant-id']:`${'1'}`
				// 'clientId':'428a8310cd442757ae699df5d894f051',
			},
			success:res => {
				// uni.request({
				// 	url:'/app-api/client/auth/refresh-token',
				// 	method:'get',
				// 	header:{
				// 		'authorization':'Bearer ' + token,
				// 		['tenant-id']:`${'1'}`
				// 	},
				// 	success:resr => {
				// 		console.log(resr)
				// 	}
				// })
				if(res.data.code == 401){ 
					uni.showToast({
						duration: 1000,
						title:res.data.msg,
						icon: 'none',
					})
					setTimeout(() => {
						uni.reLaunch({
						  // url: '/pages/login/Carmine'
						  url: '/pages/loT/login/CarmineIoT'
						})
					}, 1000)
					
				}
				// 判断状态码
				if(res.data.code == 200){
					if(res.data.code == 200){
						resolve(res);
					} else {
						reject(res)
					}
				} else {
					reject(res)
				}
			}
		})
	})
}
module.exports = {
	request:request
}